package com.xbongbong.pro.statistic.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/*
 * 云扣图表
 */
@Getter
public enum  CloudCodeChartEnum {
    ALIYUN_CALLCENTER("cloudcode","AliyunCenter","","constant.chartI18Constant.aliyun_callcenter",true),
    ALIYUN_CALLCENTER_AGENT("cloudcode","AliyunCenter","multi-page/chart-manage/statistical-analysis-seats.html#/","constant.chartI18Constant.aliyun_callcenter_agent_statistical_analysis",false),
    ALIYUN_CALLCENTER_SKILLGROUP("cloudcode","AliyunCenter","multi-page/chart-manage/statistical-analysis-skill.html#/","constant.chartI18Constant.aliyun_callcenter_skillGroup_statistical_analysis",false);
    CloudCodeChartEnum(String alias,String type,String url, String name,boolean isParent) {
        this.alias = alias;
        this.type = type;
        this.url = url;
        this.name = name;
        this.isParent = isParent;
    }
    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }

    private String alias;
    private String type;
    private String url;
    private String name;
    private boolean isParent;

    public static  CloudCodeChartEnum getParentByType(String type){
        CloudCodeChartEnum[] values = values();
        for(CloudCodeChartEnum temp:values){
            if( temp.getType().equals(type)&&temp.isParent()){
                return temp;
            }
        }
        return null;
    }

    public static List<CloudCodeChartEnum> getChildListByType(String type){
        List<CloudCodeChartEnum> list = new ArrayList<>();
        CloudCodeChartEnum[] values = values();
        for(CloudCodeChartEnum temp:values){
            if( temp.getType().equals(type)&&!temp.isParent()){
                list.add(temp);
            }
        }
        return list;
    }

}
